Handout 7: Call by Name and Call by Value

نویسنده

  • Uday Reddy
چکیده

In Handout 4, we have examined the reduction semantics of lambda calculus, and noted the difference between the normal order reduction, which chooses leftmost-outermost redexes for reduction at every stage, and the applicative order reduction, which chooses innermost redexes for reduction at every stage. We noted that the normal order reduction strategy is always able to find the normal form of a lambda calculus term, but the applicative order strategy may fail to find the normal form by carrying out reductions that are “unnecessary” for the normal form. In programming languages, the evaluation order that corresponds to normal order reduction is termed call by name. The evaluation order that corresponds to the applicative order reduction is termed call-by-value. Algol 60 was the first programming language to use the call-by-name evaluation order. However, at this early stage in the evolution of programming languages, the implications of call-by-name were not fully understood and it is said that many implementations of Algol 60 failed to implement it correctly. Many of the Algol derivatives, such as Simula 67, also used the call-by-name evaluation mechanism. Pascal and C, which were also derivatives of Algol, chose to use the call by value evaluation order because it was simpler and it was also felt that it was a more efficient execution mechanism. In functional programming, Miranda and Haskell use call-by-name evaluation order. (They actually use a variant of call-by-name order called call by need.) Other languages, including Lisp, Pop-11 and ML use the call-by-value evaluation order. In this handout, we look at the two evaluation mechanisms more closely and formalize their behaviour.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Application of Monte Carlo Simulation in the Assessment of European Call Options

In this paper, the pricing of a European call option on the underlying asset is performed by using a Monte Carlo method, one of the powerful simulation methods, where the price development of the asset is simulated and value of the claim is computed in terms of an expected value. The proposed approach, applied in Monte Carlo simulation, is based on the Black-Scholes equation which generally def...

متن کامل

Exposure to electromagnetic fields at two call centers in Turkey, 2015

Background: This study aims to evaluate the negative health impacts of exposure to electromagnetic field and to prepare a risk map of two selected call centers. Materials and Methods: Two call centers whose electromagnetic field values were measured by calibrated low high and point frequency measurement device. The measurements were performed by following the EN 50492 Standards. 178 employees ...

متن کامل

Thunks and the λ-Calculus

Thirty-five years ago, thunks were used to simulate call-by-name under call-by-value in Algol 60. Twenty years ago, Plotkin presented continuation-based simulations of call-by-name under call-by-value and vice versa in the λ-calculus. We connect all three of these classical simulations by factorizing the continuation-based call-by-name simulation Cn with a thunk-based call-by-name simulation T ...

متن کامل

Game Theoretic Analysis of Call-by-Value Computation

We present a general semantic universe of call-by-value computation based on elements of game semantics, and validate its appropriateness as a semantic universe by the full abstraction result for call-by-value PCF, a generic typed programming language with call-by-value evaluation. The key idea is to consider the distinction between call-by-name and call-by-value as that of the structure of inf...

متن کامل

Duality between Call-by-Name Recursion and Call-by-Value Iteration

We investigate the duality between call-by-name recursion and call-by-value iteration in the λμ-calculi and their models. Semantically, we consider that iteration is the dual notion of recursion. Syntactically, we extend the call-by-name λμ-calculus and the call-by-value one with a fixed-point operator and an iteration operator, respectively. This paper shows that the dual translations between ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2010